package package001;

import org.junit.Test;

/**
 * @author futao
 * Created on 2017/11/16 - 14:36.
 */
public class SingleTom {
    private String name;
    private int age;
    private Double hight;

    private SingleTom(String name, int age, Double hight) {
        this.name = name;
        this.age = age;
        this.hight = hight;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Double getHight() {
        return hight;
    }

    public void setHight(Double hight) {
        this.hight = hight;
    }

    /**
     * 单例模式
     * 定义一个使用private构造方法并且用静态字段来持有这个类仅有的实例
     */
    static {
        new SingleTom("默认", 18, 66.6);
    }
}